package com.ajr.core;

import java.io.File;
import java.io.FileInputStream;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Iterator;
import java.util.Properties;

import org.apache.log4j.Logger;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

import com.ajr.core.db.ConfigurationRow;

public class Settings {
	static Logger logger = Logger.getLogger(Settings.class); 
	
	Session session = null;

	Properties properties;
	static Settings settings = new Settings();

	private static final String SPCS_EXPORT_PAYMENT_CASH_NOTE = "SPCS_EXPORT_PAYMENT_CASH_NOTE";
	private static final String SPCS_PRODUCT_ATTRIBUTES_INCLUDE = "SPCS_PRODUCT_ATTRIBUTES_INCLUDE";
	private static final String SPCS_SYNCRONIZE_ARTICLE_INFORMATION = "SPCS_SYNCRONIZE_ARTICLE_INFORMATION";
	private static final String SPCS_INCLUDE_CUSTOMER_COUNTRYCODE = "SPCS_INCLUDE_CUSTOMER_COUNTRYCODE";
	private static final String SPCS_ORDER_NUMBER_CHOOSE = "SPCS_ORDER_NUMBER_CHOOSE";
	private static final String SPCS_VAT_INCLUDE = "SPCS_VAT_INCLUDE";
	private static final String SPCS_CUSTOMER_EXPORT_FAX_AS_TELEPHONE2 = "SPCS_CUSTOMER_EXPORT_FAX_AS_TELEPHONE2";
//	private static final String SPCS_CUSTOMER_NEWORUPDATED_INFORMATION = "SPCS_CUSTOMER_NEWORUPDATED_INFORMATION";
	private static final String SPCS_CUSTOMER_CHOOSE_NUMBER = "SPCS_CUSTOMER_CHOOSE_NUMBER";
	private static final String SPCS_ADD_BILLING_REFERENCE = "SPCS_ADD_BILLING_REFERENCE";
	private static final String SPCS_EXPORT_JINTERBROKER_TABLES = "SPCS_EXPORT_JINTERBROKER_TABLES";
	private static final String SPCS_OSCOMMERCE_STANDARD_LANGUAGE = "SPCS_OSCOMMERCE_STANDARD_LANGUAGE";
//	private static final String SPCS_READ_CONFIGURE_ONCE = "SPCS_READ_CONFIGURE_ONCE";
	private static final String SPCS_EXPORT_VAT_ACTION = "SPCS_EXPORT_VAT_ACTION";
//	private static final String SPCS_ORDER_VAT_VALUE = "SPCS_ORDER_VAT_VALUE";
	private static final String SPCS_ORDER_NUMBER_SERIES = "SPCS_ORDER_NUMBER_SERIES";
	private static final String SPCS_ORDER_STATUS_VALUE = "SPCS_ORDER_STATUS_VALUE";
	private static final String SPCS_ORDER_STATUS_CHANGE = "SPCS_ORDER_STATUS_CHANGE";
	private static final String SPCS_EXPORT_TYPE = "SPCS_EXPORT_TYPE";
	private static final String SPCS_EXPORT_CASH_NOTE = "SPCS_EXPORT_CASH_NOTE";
	private static final String SPCS_EXPORT_JINTERBROKER_ADDRESS = "SPCS_EXPORT_JINTERBROKER_ADDRESS";
	private static final String SPCS_CARGO_VALUE_FIELDS = "SPCS_CARGO_VALUE_FIELDS";
	private static final String SPCS_DISPATCH_VALUE_FIELDS = "SPCS_DISPATCH_VALUE_FIELDS";
	private static final String SPCS_CUSTOMER_SOCIAL_AND_TAX_ID_INCLUDE = "SPCS_CUSTOMER_SOCIAL_AND_TAX_ID_INCLUDE";
	private static  final String SPCS_SPPC_VAT_POLICY = "SPCS_SPPC_VAT_POLICY";
	private static  final String SPCS_CUSTOMER_NUMBER_PREFIX = "SPCS_CUSTOMER_NUMBER_PREFIX";
	
	private static  final String SPCS_ECONOMIC_UNIT_INCLUDE = "SPCS_ECONOMIC_UNIT_INCLUDE";
	private static  final String SPCS_PRODUCTS_DISCOUNT_INCLUDE = "SPCS_PRODUCTS_DISCOUNT_INCLUDE";
	private static  final String SPCS_PRODUCTS_ACCOUNT_INCLUDE = "SPCS_PRODUCTS_ACCOUNT_INCLUDE";
	private static  final String SPCS_PRODUCTS_SUPPLIERS_PRICE_INCLUDE = "SPCS_PRODUCTS_SUPPLIERS_PRICE_INCLUDE";
	private static  final String SPCS_PRODUCTS_BATCH_INCLUDE = "SPCS_PRODUCTS_BATCH_INCLUDE";
	
	private static  final String SPCS_DEFAULT_PAYMENT_METHOD = "SPCS_DEFAULT_PAYMENT_METHOD";

//	private static final String SPCS_CUSTOMER_SOCIAL_AND_TAX_ID_INCLUDE = "SPCS_CUSTOMER_SOCIAL_AND_TAX_ID_INCLUDE";

	// double vat_value = 0;

	/*public double getVat_value() {
		try {
			return Double.parseDouble(properties
					.getProperty("spcs.order.vat.value"));
		} catch (Exception e) {
			// TODO: handle exception
		}
		return 0;
	}*/

	/*
	 * public void setVat_value(double vatValue) { vat_value = vatValue; }
	 * 
	 * public void setVat_value(String vatValue) { try { vat_value =
	 * Double.parseDouble(vatValue); } catch (Exception e) { } }
	 */

	private Settings() {
		logger.info("initialize settings");
		try {
			properties = new Properties();
			File f = new File("export.properties");
			logger.info("export properties path "+f.getAbsolutePath());
			System.out.println("export properties path "+f.getAbsolutePath());
			FileInputStream find = new FileInputStream(f);
			properties.load(find);
			loadDataBaseConfigurations();
			logger.info("properties " + properties);
			// setVat_value(getProperty("spcs.order.vat.value"));

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}

	}
	public Session getSessionFactory() {
		return getSessionFactory(true);
	}
	
	public Session getSessionFactory(boolean error) {
		try {
			if(session == null) {
				logger.info("Session is null so creating connection");
				Configuration configuration = new Configuration().configure();
				
				configuration.setProperty("hibernate.connection.url", getConnectionURL());
				configuration.setProperty("hibernate.connection.username", getUserName());
				configuration.setProperty("hibernate.connection.password", getPassword());
				SessionFactory sessionFactory = configuration.buildSessionFactory();
				session = sessionFactory.openSession();
				
			}else if(!error || !session.isOpen() || !session.isConnected() || session.isDirty()) {
				logger.info("Session is not open or not connected so reconstructing");
				session.close();
				Configuration configuration = new Configuration().configure();

				configuration.setProperty("hibernate.connection.url", getConnectionURL());
				configuration.setProperty("hibernate.connection.username", getUserName());
				configuration.setProperty("hibernate.connection.password", getPassword());
				SessionFactory sessionFactory = configuration.buildSessionFactory();
				session = sessionFactory.openSession();
			}else {
				logger.info("Session is avialable. so it is returned as it is ");
			}
			
			
			
			return session;
			
		} catch (Exception e) {
			logger.error("Error getting session factory", e);
		}
		return null;
		
	}
	
	public void loadDataBaseConfigurations() {
		loadDataBaseConfigurations(true);
	}

	public void loadDataBaseConfigurations(boolean retryIfError) {
		logger.info("Loading database configurations retryIfError "+retryIfError);
		try {
			Session session = getSessionFactory(retryIfError);
			String SQL_QUERY = " from ConfigurationRow where configuration_group_id = 101"; // as insurance where
			// insurance.lngInsuranceId='1'
			Query query = session.createQuery(SQL_QUERY);
			int c = 0;
			for (Iterator it = query.iterate(); it.hasNext();) {
				ConfigurationRow configurationRow = (ConfigurationRow)it.next();
				properties.put(configurationRow.getConfiguration_key(), configurationRow.getConfiguration_value());
				logger.info(configurationRow.getConfiguration_key() + ":" + configurationRow.getConfiguration_value());
			}
			session.flush();
			session.close();
		}catch(Exception e) {
			session.flush();
			session.close();
			session = null;
			if(retryIfError) {
				loadDataBaseConfigurations(false);
			}
			logger.error("Error while loading configurations", e);
		}
		
	}
	public void loadDataBaseConfigurations1() {
		logger.info("Loading database configurations");
		
		String url = getConnectionURL();
		String user = getUserName();
		String password = getPassword();
		String driver = getDriverClassName();

		Statement stmt1 = null;
		ResultSet rs1 = null;
		java.sql.Connection c = null;

		try {
			Class.forName(driver);
			DriverManager.getConnection(url, user, password);
			// Session session = sessionFactory.openSession();
			// java.sql.Connection c =
			// sessionFactory.openSession().connection();
			c = DriverManager.getConnection(url, user, password);

			String orderDetailSQL = "select c.configuration_id,c.configuration_group_id ,c.configuration_key,c.configuration_value "
					+ "from configuration c where configuration_group_id = 101";
			stmt1 = c.createStatement();
			rs1 = stmt1.executeQuery(orderDetailSQL);
			// OrderDetails orderDetails = new OrderDetails();
			while (rs1.next()) {
				String keyName = rs1.getString("configuration_key");
				String keyValue = rs1.getString("configuration_value");
				properties.put(keyName, keyValue);
				logger.info(keyName + ":" + keyValue);
			}
		} catch (Exception e) {
			logger.error("Error loading configurations from database", e);

		} finally {
			try {
				rs1.close();
				stmt1.close();
				c.close();
			} catch (Exception e2) {
				logger.error("Error closing connections", e2);
			}
		}

		// logger.info("properties "+properties);
	}

	public static Settings getInstance() {
		return settings;
	}

	/*
	 * public int getVatPolicy() { return (vat_value != 0)?1:0; }
	 */

	/*
	 * public boolean isFaxExport() { // TODO Auto-generated method stub return
	 * true; }
	 */

	public boolean isExportSpcsJInterTables() {
		try {
			String value = getProperty(SPCS_EXPORT_JINTERBROKER_TABLES);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return true;
	}

	public boolean isLetSpcsChooseOrderNumber() {
		try {
//			String value = getProperty("spcs.order.number.choose");
			String value = getProperty(SPCS_ORDER_NUMBER_CHOOSE);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return true;
	}

	public String getSpcsOrderNumberSeries() {
		try {
			String value = getProperty(SPCS_ORDER_NUMBER_SERIES);
			return value;

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return "900000";
	}
	
	private String getProperty(String propertyName) throws Exception {
		String value = properties.getProperty(propertyName);
		if(value == null) {
			throw new Exception("Property not available "+propertyName);
		}
		return value;
		
	}

	public String getSpcsCustomerNumberSeries() {
		try {
			String value = getProperty(SPCS_CUSTOMER_NUMBER_PREFIX);
			return value;

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return "900000";
	}
	
	public boolean isChangeOrderStatus4Export() {
		try {
			String value = getProperty(SPCS_ORDER_STATUS_CHANGE);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}
	
	
	public boolean isEconomicInclude() {
		try {
			String value = getProperty(SPCS_ECONOMIC_UNIT_INCLUDE);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}	
	
	public boolean isProductDiscountInclude() {
		try {
			String value = getProperty(SPCS_PRODUCTS_DISCOUNT_INCLUDE);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}
	
	public boolean isProductAccountsInclude() {
		try {
			String value = getProperty(SPCS_PRODUCTS_ACCOUNT_INCLUDE);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}
	
	public boolean isSuppliersPriceInclude() {
		try {
			String value = getProperty(SPCS_PRODUCTS_SUPPLIERS_PRICE_INCLUDE);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}
	
	public boolean isProductsBatchInclude() {
		try {
			String value = getProperty(SPCS_PRODUCTS_BATCH_INCLUDE);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}
	
	public String getSpcsOrderChangeStatus() {
		try {
			String value = getProperty(SPCS_ORDER_STATUS_VALUE);
			return value;

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return "Mottagen";
	}

	public String getVatAction() {
//		if(true) return "add";
		try {
			String value = getProperty(SPCS_EXPORT_VAT_ACTION);
			return value;

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return "noaction";
	}

	public boolean isIncludeVat4Invoice() {
		try {
			String value = getProperty(SPCS_VAT_INCLUDE);
			value = getProperty("SPCS_VAT_INCLUDE");
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}
	
	public boolean isIncludeVatOnShipping() {
		try {
			String value = getProperty("SPCS_CARGO_AND_DISPATCH_VAT");
			value = getProperty("SPCS_CARGO_AND_DISPATCH_VAT");
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}

		return false;
	}
	
	public boolean isIncludeVatOnCargo() {
		try {
			String value = getProperty("SPCS_CARGO_AND_DISPATCH_VAT");
			value = getProperty("SPCS_CARGO_AND_DISPATCH_VAT");
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}

		return false;
	}
	
	/*public double getDefaultTax() {
		return 25D;
	}*/
	
	public boolean getSpcsVatPolicy() {
		try {
			String value = getProperty(SPCS_SPPC_VAT_POLICY);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}

	
	public boolean isCreateCashNote() {
		try {
			String value = getProperty(SPCS_EXPORT_CASH_NOTE);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}

	public String getCreateCashNoteValue() {
		try {
//			String value = properties
//					.getProperty("spcs.create.cash.note.value");
			String value = getProperty(SPCS_EXPORT_PAYMENT_CASH_NOTE);
			return value;

		} catch (Exception e) {
			// TODO: handle exception
		}
		return "";
	}

	/*public String getExportPaymentCodes() {
		try {
//			String value;// =
							// getProperty("spcs.create.cash.note.value");
			String value = getProperty(SPCS_EXPORT_PAYMENT_CODES);
			return value;

		} catch (Exception e) {
			// TODO: handle exception
		}
		return "";

	}*/

	public String getSocsExportType() {
		try {
			String value = getProperty(SPCS_EXPORT_TYPE);
			return value;

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return "invoice";
	}

	public String getCargoAmountValuesFields() {
		try {
			String value = getProperty(SPCS_CARGO_VALUE_FIELDS);
			return value;

		} catch (Exception e) {
			// TODO: handle exception
		}
		return "ot_shipping";
	}

	public String getDispatchAmountValuesFields() {
		try {
			String value = getProperty(SPCS_DISPATCH_VALUE_FIELDS);
			return value;

		} catch (Exception e) {
			// TODO: handle exception
		}
		return "ot_handling";
	}

	public boolean isIncludeProductAttributes4Invoice() {
		try {
//			String value = properties
//					.getProperty("spcs.product.attributes.include");
			String value = getProperty(SPCS_PRODUCT_ATTRIBUTES_INCLUDE);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}

	public boolean isSynchronizeArticleInformation() {
//		if(true) return true;
		try {
//			String value = properties
//					.getProperty("spcs.synchorize.article.information");
			String value = getProperty(SPCS_SYNCRONIZE_ARTICLE_INFORMATION);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}

	public boolean isExportCustomerFaxAsTelphone2() {
		try {
//			String value = properties
//					.getProperty("spcs.customer.export.fax.as.telphone2");
			String value = getProperty(SPCS_CUSTOMER_EXPORT_FAX_AS_TELEPHONE2);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}

	public boolean isIncludeCountryCode4Customers() {
		try {
//			String value = properties
//					.getProperty("spcs.include.customer.countrycode");
			String value = getProperty(SPCS_INCLUDE_CUSTOMER_COUNTRYCODE);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}

	/*public boolean isPlaceNewOrUpdatedCusomer4Group() {
		try {
//			String value = properties
//					.getProperty("spcs.customer.neworupdated.information");
			String value = properties
					.getProperty(SPCS_CUSTOMER_NEWORUPDATED_INFORMATION);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}*/

	public boolean isLetSpcsChooseCusomerNumber() {
//		if(true) return true;
		try {
//			String value = properties
//					.getProperty("spcs.customer.choose.number");
			String value = getProperty(SPCS_CUSTOMER_CHOOSE_NUMBER);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}

	public String getOSCommerceStandardLanguageID() {
		try {
//			String value = properties
//					.getProperty("spcs.oscommerce.standard.language.id");
			String value = getProperty(SPCS_OSCOMMERCE_STANDARD_LANGUAGE);

			return value;

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return "7";
	}
	public String getDefaultPaymentMethod() {
		try {
//			String value = properties
//					.getProperty("spcs.oscommerce.standard.language.id");
			String value = getProperty(SPCS_DEFAULT_PAYMENT_METHOD);

			return value;

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return "";
	}

	public String getPriceListCode() {
		return "";
	}

	public boolean isAddBillingRefence() {
		try {
//			String value = getProperty("spcs.add.billing.reference");
			String value = getProperty(SPCS_ADD_BILLING_REFERENCE);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return true;
	}

	/*public  boolean isCreateCashNoteIfCreditCardPayment() {
		try {
//			String value = getProperty("spcs.add.billing.reference");
			String value = getProperty(SPCS_ADD_BILLING_REFERENCE);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}*/

	
	public  boolean isReadConfigureOnce() {
	    return false;
		/*try {
//			String value = getProperty("spcs.add.billing.reference");
			String value = getProperty(SPCS_READ_CONFIGURE_ONCE);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;*/
	}
	
	/*public  String getOrderVatInclude() {
		try {
//			String value = getProperty("spcs.add.billing.reference");
			String value = getProperty(SPCS_ORDER_VAT_VALUE);
			return value;

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return String.valueOf(0);
	}*/
	
	public boolean isExportJInterBrokerAddress() {
		try {
//			String value = getProperty("spcs.add.billing.reference");
			String value = getProperty(SPCS_EXPORT_JINTERBROKER_ADDRESS);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return true;
	}
	
	public boolean isCustomerSocialAndTaxIDInclude() {
		try {
//			String value = getProperty("spcs.add.billing.reference");
			String value = getProperty(SPCS_CUSTOMER_SOCIAL_AND_TAX_ID_INCLUDE);
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}
	
	
	
	/*
	 * public static String getOrderHeadProfitCentre() { // TODO Auto-generated
	 * method stub return ""; }
	 */

	public String getSystemPath() {
		try {
			return getProperty("system_path");
		} catch (Exception e) {
			logger.error("Error reading property", e);

		}
		return "system_path";
	}

	public String getLibraryPath() {
		try {
			return getProperty("dll_path");
		} catch (Exception e) {
			logger.error("Error reading property", e);

		}
		return "dllpath";
	}

	public String getCompanyPath() {
		try {
			return getProperty("company_path");
		} catch (Exception e) {
			logger.error("Error reading property", e);

		}
		return "company_path";
	}

	public String getConnectionURL() {
		try {
			return getProperty("hibernate.connection.url");
		} catch (Exception e) {
			logger.error("Error reading property", e);

		}
		return "connection url";
	}

	public String getUserName() {
		try {
			return getProperty("hibernate.connection.username");
		} catch (Exception e) {
			logger.error("Error reading property", e);

		}
		return "root";
	}

	public String getPassword() {
		try {
			return getProperty("hibernate.connection.password");
		} catch (Exception e) {
			logger.error("Error reading property", e);

		}
		return "";
	}

	public String getDriverClassName() {
		try {
			return getProperty("hibernate.connection.driver_class");
		} catch (Exception e) {
			logger.error("Error reading property", e);
		}
		return "com.mysql.jdbc.Driver";
	}

	public boolean isUseCustomerGroup() {
		// TODO Auto-generated method stub
		
		try {
//			String value = properties
//					.getProperty("spcs.customer.export.fax.as.telphone2");
			String value = getProperty("SPCS_SPPC_CUSTOMER_GROUPS");
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return 	false;
	}

	public boolean isJInterBrokerBehavior() {
//		if(true) return false;
		try {
//			String value = properties
//					.getProperty("spcs.customer.export.fax.as.telphone2");
			String value = getProperty("SPCS_JINTERBROKER_BEHAVIOR");
			return Boolean.parseBoolean(value);

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		return false;
	}

	public String getStockType() {
//		if(true) return false;
		try {
//			String value = properties
//					.getProperty("spcs.customer.export.fax.as.telphone2");
			String value = getProperty("SPCS_EXPORT_STOCK_TYPE");
			return value;

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		// TODO Auto-generated method stub
		return "";
	}

	public String getSpcsCustomerGroup() {
		try {
//			String value = properties
//					.getProperty("spcs.customer.export.fax.as.telphone2");
			String value = getProperty("SPCS_EXPORT_CUSTOMERS_GROUP");
			return value;

		} catch (Exception e) {
			logger.error("Error reading poperty ",e);
		}
		// TODO Auto-generated method stub
		return "";
	}

}
